<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>4常见网页布局样式</title>
		<style>
			* {
				margin: 0;
				padding: 0;
			}
			.top {
				height: 40px;
				background-color: #10b076;
			}
			.banner {
				width: 1150px;
				height: 200px;
				margin: 10px auto;
				background-color: #10b076;
			}
			.main {
				width: 1150px;
				margin: 0 auto;
				border: 2px solid red;
				/* 第二种清除浮动的代码 */
				/* overflow: hidden; */
			}
			.main div {
				float: left;
				width: 280px;
				height: 100px;
				background-color: #fffae8;
				margin-right: 10px;
				margin-top: 10px;
			}
			.main .last {
				margin-right: 0px;
			}
			.footer {
				height: 200px;
				background-color: #10b076;
				margin-top: 10px;
			}
			
			/* 第三种清除浮动的方法 */
/* 			.clearfix:after			   {				content: "";				display: block;				height: 0;				clear: both;				visibility: hidden;			}
			 */
			.clearfix:before,			.clearfix:after{				content: "";				display: table;				}			.clearfix:after{
				clear:both
				}
		</style>
	</head>
	<body>
		<div class="top">top</div>
		<div class="banner">banner</div>
		<div class="main clearfix">
			<div>1</div>
			<div>2</div>
			<div>3</div>
			<div class="last">4</div>
			<div>1</div>
			<div>2</div>
			<div>3</div>
			<div class="last">4</div>
			<div>1</div>
			<div>2</div>
			<div>3</div>
			<div class="last">4</div>
			<div>1</div>
			<div>2</div>
			<div>3</div>
			<div class="last">4</div>
			<!--第一种 我们在这里添加的情况比较多，
			这里需要注意千万不要给标签带有样式 
			要不然就不算空标签了-->
			<!-- <p style="clear: both;"></p> -->
		</div>
		<!-- <p style="clear: both;"></p> -->
		<div class="footer">footer</div>
	</body>
</html>